
<!DOCTYPE html>
<html lang="en-US">

<!-- Mirrored from oj.zknoi.com/goc/gocWeb.html by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 08 Apr 2024 05:13:51 GMT -->
<head>
    <Link Rel="SHORTCUT ICON" href="../../zdxq-1306213535.cos.ap-beijing.myqcloud.com/zdxq/favicon.png">
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="description" content="GoC的Web版，可以用C语言语法命令进行编程绘图，主要用于程序设计语言C++入门学习。">
	<meta name="keywords" content="GoC 编程 绘图">
	<link rel="stylesheet" type="text/css" href="css/all.css?v=1.1">
	<link rel="stylesheet" href="layui/css/layui.css">
	<title>韦哲机器人GoC在线编辑器</title>
</head>
<body style="background: #d2dae2;">
	<div class="game_header">
		<a href="#" class="logo3"><img src="images/goc_logo.png" height="50" alt=""></a>
		<div class="ht_login_register">
			<div class="login_student" style="display:none;">
					<div class="student_info clearfix">
						<span class="ui-nowrap" title="同学">你好!</span>
						<i></i>
					</div>
					<div class="student_updown"  >
						<ul>
						    <li><a href="javascript:load_code();" >调入程序</a></li>
							<li><a href="javascript:save_code();" >保存程序</a></li>
							<!--<li><a href="javascript:;" class="code_help">帮助</a></li>-->
						</ul>
					</div>
			</div>
		</div>
		
	</div>
	<div id="mainAll" style="margin-top :10px ; margin-left:auto;margin-right:auto; " >
			<div class="layui-fluid clearfix">
				<div id="mainLeft">
					<div class="mainLeft_head clearfix">
						<div class="crumbs" id="_title" >							
							<a href="javascript:;">韦哲机器人GoC在线编辑器</a>
							<div style="display: inline-block;" >------橘子老师提供技术支持</div>  						
						</div>  				
					</div>				
					<div  class="canvasBox" >  					
					 <canvas id="canvas_background" style=" background-color: white ;" class="canvas" >  
					 </canvas>		  
					 <canvas id="canvas_std" class="canvas">  </canvas>	
					 <canvas id="canvas_pic1" class="canvas">  </canvas>		  
					 <canvas id="canvas_code" class="canvas">  </canvas>
					 <canvas id="canvas_pic" class="canvas">  </canvas>
					 <canvas id="canvas_pen" class="canvas">  </canvas>	
					 <canvas id="canvas_top" class="canvas">  </canvas>					 
					</div>       
					
				</div>
				<div id="mainRight">
					<div class="game_code">
					    <div class ="code_top1">
					       <span>
							  <a href="javascript:goc.HOME();" class="background "><i class="layui-icon" >&#xe9aa;</i>清屏</a>
							  <a  id="setOption" href="#" ><i class="layui-icon">&#xe614;</i> 设置 </a>	
							</span>  
							
						    <span class="code_top">							
							  <a href="javascript:goc_button.XY();" class="coordinate"><i>&#xe633;</i>坐标</a>						
							  <a href="javascript:goc_button.Col();" class="color_number"><i>&#xe65b;</i>色号</a>	
						    </span>
					    </div>
					
						   <div  id="codeMirror-area">					
						   </div>  				
						

						<div class="code_button" style="text-align: center;" >
						   <a href="javascript:goc.run_kill();" class="code_run">运行</a>
						   <a href="javascript:mode.newWin();" class="code_submit">演示</a>
						   <a href="javascript:;" class="code_input">常见命令</a>
						   <div style="height: 20px;">asdsad</div>
						   <a href="javascript:load_code();" class="code_run">导入文件</a>
						   <a href="javascript:get_code();" class="code_submit">保存文件</a>
						</div>						
					</div>
					
				</div>
		    </div>
  	</div>  
 <input type ="file" id="file_load"  style="display:none"  accept=".cpp"  name="load_file" value="goc.cpp" onchange="loadFile()"; />
 <div  class="code_ts" >
	<div style="margin-top:-15px; font-size: 18px; color: #000000;" >
	   <b>cinWin &nbsp;</b>
		<textarea style="display:block;width:100%;padding-left:10px;border-radius:5px;border:1px solid #f2d0ae;"; rows="3"; id="cin-area"  ></textarea>
	</div>
	<div style="margin-top:5px; font-size: 18px; color: #000000; " >
	   <b>coutWin</b>
	   <textarea style="display:block;width:100%;  padding-left:10px;border-radius:5px; border:1px solid #f2d0ae; background:#fffbf5;" rows="3"; id="cout-area" readonly ></textarea>  					   
	</div>
	
</div>
</body>

<script src="js/all_p.js"></script>
<script src="layui/layui.js"></script>
<script src="js/priv/all.js"></script>
<script>
	function get_code(){
		var text = "";
		var code = document.querySelectorAll(".CodeMirror-line")
		code.forEach((index)=>{
			text+=index.textContent+"\n";
		})

		function saveTextAsFile(text, filename) {
    const blob = new Blob([text], { type: 'text/plain' });
    const url = URL.createObjectURL(blob);
    const a = document.createElement('a');
    a.href = url;
    a.download = filename;
    document.body.appendChild(a);
    a.click();
    document.body.removeChild(a);
    URL.revokeObjectURL(url);
}

saveTextAsFile(text, 'example.txt');

		console.log(text)
	}
</script>
</html>
